package com.snopy.concurrency.demo_threadpool;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.TimeUnit;



@Slf4j(topic = "测试信息")
public class Test1 {
    
    public static void main(String[] args) {
        ThreadPool threadPool = new ThreadPool(2, 1000, TimeUnit.SECONDS, 5);

        for (int i = 0; i < 10; i++) {
            int j = i;
            threadPool.execute(() -> {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                log.info("执行任务：{}", j);
            });
        }
        log.info("test");
        threadPool.execute(()->{
            log.info("this is a task!");
        });
    }
}
